#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-11-19 8:58 上午
# @Author  : yangdy
# @File    : 2020-11-19.283.移动零
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def moveZeroes(self, nums: List[int]) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        i, j = 0, 0

        while i < len(nums):
            while j < len(nums) and nums[j] != 0:
                j += 1
            while i < len(nums) and nums[i] == 0:
                i += 1
            if j < len(nums) and len(nums) > i > j:
                nums[i], nums[j] = nums[j], nums[i]
                j += 1
            i += 1
